﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;

namespace MrPP.SerriedCabinet
{
  
    public class CheckReceive : NetworkBehaviour//, IBridgeReceiver
    {
        public struct ItemData
        {
            string name;
            string id;
               
        }


        public class DataSyncList : SyncList<ItemData> { }
        public DataSyncList datas = new DataSyncList();


        void changed(DataSyncList.Operation op, int index, ItemData oldItem, ItemData newItem)

       // void changed(DataSyncList.Operation op, int itemIndex)
        {
            
        }

        private static CheckReceive Instance_;
        public static CheckReceive Instance
        {
            get
            {
                return Instance_;
            }
        }
        void Dostroy() {
            datas.Callback -= changed;
        }
        void Start() {
            Instance_ = this;
            datas.Callback += changed;
        }
        enum State { 
            Waiting,
            Runing,
        }
        [SyncVar(hook ="changeOpen")]
        public uint open = 0;

        public Action<uint, uint> onOpen;
        private void changeOpen(System.UInt32 oldValue, System.UInt32 newValue) {
            onOpen?.Invoke(open, newValue);
            //open = value;
        }

        
    }
}